import { createRouter, createWebHistory } from 'vue-router'

export const menu_router = [
  {
    path: '/',
    name: 'home',
    meta: {
      title: '首页'
    },
    component: () => import('../views/home/indexView.vue')
  },
  {
    path: '/list',
    name: 'list',
    meta: {
      title: '列表'
    },
    component: () => import('../views/list/indexView.vue')
  },
  {
    path: '/customer',
    name: 'customer',
    meta: {
      title: '客服'
    },
    component: () => import('../views/customer/indexView.vue')
  },
  {
    path: '/set',
    name: 'set',
    meta: {
      title: '设置'
    },
    component: () => import('../views/set/indexView.vue')
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('../views/layout/indexView.vue'),
      children: menu_router
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/indexView.vue')
    },
    {
      path: '/403',
      name: '403',
      component: () => import('../views/403/indexView.vue')
    },
    {
      path: '/404',
      name: '404',
      component: () => import('../views/404/indexView.vue')
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404'
    }
  ]
})

export default router
